<template>
  <div class="search">
    <a-form :model="table" name="basic" layout="inline" autocomplete="off" v-bind="layout">
      <a-form-item label="来源机构" name="dcSourceStructure">
        <a-select v-model:value="table.dcSourceStructure" allow-clear placeholder="请选择" style="width: 120px" :options="SourceStructure" />
      </a-form-item>
      <a-form-item label="标准状态" name="dcStatus">
        <a-select v-model:value="table.dcStatus" allow-clear placeholder="请选择" style="width: 120px" :options="options" />
      </a-form-item>
      <a-form-item label="标准编号" name="dcCode">
        <a-input v-model:value="table.dcCode" placeholder="请输入" style="width: 120px" />
      </a-form-item>
      <a-form-item label="中文名称" name="dcChName">
        <a-input v-model:value="table.dcChName" placeholder="请输入" style="width: 120px" />
      </a-form-item>
      <a-form-item label="英文名称" name="dcEnName">
        <a-input v-model:value="table.dcEnName" placeholder="请输入" style="width: 120px" />
      </a-form-item>
      <a-form-item>
        <a-button @click="reset">重置</a-button>
      </a-form-item>
      <a-form-item><a-button type="primary" @click="searchDataStandsrds">查询</a-button></a-form-item>
    </a-form>
  </div>
</template>

<script lang="ts" setup>
  import { CodeTableStatus } from '@/enums/statusEnum';
  import { getStanardListHooks } from '@/hooks/CatalogDataStandardsHooks/getDataStandarsHooks';
  const { getData, table } = getStanardListHooks();
  const layout = {
    labelCol: { span: 12 },
    wrapperCol: { span: 16 },
  };
  // 选择器的三种状态
  const options: {
    value: number;
    label: String;
  }[] = [
    {
      value: CodeTableStatus.未发布,
      label: '未发布',
    },
    {
      value: CodeTableStatus.已发布,
      label: '已发布',
    },
    {
      value: CodeTableStatus.已停用,
      label: '已停用',
    },
  ];
  const SourceStructure: {
    value: string;
    label: String;
  }[] = [
    {
      value: '数宜信',
      label: '数宜信',
    },
  ];
  // 查询
  const searchDataStandsrds = () => {
    table.num = 1;
    table.size = 10;
    getData();
  };
  // 重置
  const reset = () => {
    table.dcChName = '';
    table.dcCode = '';
    table.dcEnName = '';
    table.dcSourceStructure = undefined;
    table.dcStatus = undefined;
    table.num = 1;
    table.size = 10;
    getData();
  };
</script>

<style lang="less" scoped></style>
